class Event < ActiveRecord::Base
   validates_presence_of :date
  validates_format_of :date, 
                      :with => /^[0-9]{4}[-][0-9]{2}[-][0-9]{2}$/ ,
                      :message => "is missing or invalid. Please enter a valid date in this format: yyyy-mm-dd."
  
   
  validates_presence_of :place 
  validates_length_of :place, :in => 3..15
    
  validates_presence_of :name 
  validates_length_of :name, :in => 3..30
  
  validates_presence_of :obs 
  validates_length_of :obs, :in => 3..100
  #validates_uniqueness_of :obs
 
  validates_numericality_of :fees   
  validates_presence_of :fees
  #validates_length_of :fees, :maximum => 3
  
                      
	has_many :attendances
	has_many :users, :through => :attendances
end
